| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /* globals versionCompare, atob, btoa */ |
||
| 36 | this.versionControl = function () { |
||
| 37 | // delete saves older than this version |
||
| 38 | if (state.player.version && versionCompare(state.player.version, '2.1.0') < 0) { |
||
| 39 | state.player = {}; |
||
| 40 | } |
||
| 41 | // we merge the properties of the player with the start player to |
||
| 42 | // avoid undefined errors with new properties |
||
| 43 | state.player = angular.merge({}, data.start_player, state.player); |
||
| 44 | // append an id if it doesn't exist |
||
| 45 | if (!state.player.id) { |
||
| 46 | state.player.id = Math.random().toString().substring(3); |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 51 |